﻿using System;

using System.Collections.Generic;
using System.Text;

namespace Silvermoon.Animations
{
    public class PowerEase : EasingFunctionBase
    {

        public static readonly PowerEase In = new PowerEase { Mode = EasingMode.EaseIn };
        public static readonly PowerEase Out = new PowerEase { Mode = EasingMode.EaseOut };
        public static readonly PowerEase InOut = new PowerEase { Mode = EasingMode.EaseInOut };

        public static readonly PowerEase QuadraticIn = new PowerEase { Mode = EasingMode.EaseIn, Power = 2.0f };
        public static readonly PowerEase QuadraticOut = new PowerEase { Mode = EasingMode.EaseOut, Power = 2.0f };
        public static readonly PowerEase QuadraticInOut = new PowerEase { Mode = EasingMode.EaseInOut, Power = 2.0f };

        public static readonly PowerEase CubicIn = new PowerEase { Mode = EasingMode.EaseIn, Power = 3.0f };
        public static readonly PowerEase CubicOut = new PowerEase { Mode = EasingMode.EaseOut, Power = 3.0f };
        public static readonly PowerEase CubicInOut = new PowerEase { Mode = EasingMode.EaseInOut, Power = 3.0f };

        public static readonly PowerEase QuarticIn = new PowerEase { Mode = EasingMode.EaseIn, Power = 4.0f };
        public static readonly PowerEase QuarticOut = new PowerEase { Mode = EasingMode.EaseOut, Power = 4.0f };
        public static readonly PowerEase QuarticInOut = new PowerEase { Mode = EasingMode.EaseInOut, Power = 4.0f };

        public double Power { get; set; }

        public PowerEase()
            : base()
        {
            Power = 3.8d;
        }

        protected override float EaseValue(float normalizedTime)
        {
            return (float)Math.Pow((double)normalizedTime, Power);
        }
    }
}
